<template>
  <view class="box">
    <view class="store-item" v-for="(store, sIndex) in storeList" :key="sIndex">
      <view class="store-left">
        <image :src="store.imgUrl" class="store-logo"></image>
      </view>
      <view class="store-right">
        <text class="store-name">{{ store.name }}</text>
        <view class="store-details">
          <text class="gray-text">月售: {{ store.sales}} 起送: {{ store.expressLimit}} 基础运费: {{ store.expressPrice }}</text>
          <text class="red-text">{{ store.slogan}}</text>
        </view>
      </view>
    </view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      storeList: []
    };
  },
  methods: {
   
    fetchStores() {
      uni.request({
        url: 'http://localhost:3000/hotlist', 
        method: 'GET',
        success: (res) => {
          this.storeList = res.data;
        },
        fail: (err) => {
          console.error('请求店铺数据失败:', err);
        }
      });
    }
  },
  mounted() {
    this.fetchStores();
  }
};
</script>

<style>
.box {
  width: auto;
  background-color: #fff;
  padding: 10px;
}

.store-item {
  display: flex;
  align-items: center;
  border-bottom: 1px solid #eaeaea;
  padding: 10px 0;
}

.store-left {
  margin-right: 10px;
}

.store-logo {
  width: 60px;
  height: 60px;
}

.store-right {
  flex: 1;
}

.store-name {
  font-size: 16px;
  font-weight: bold;
  margin-bottom: 5px;
}

.store-details {
  font-size: 12px;
}

.gray-text {
  color: #666;
}

.red-text {
  color: #FF5722;
}
</style>